<?php
namespace app\wework\home;

use app\common\controller\Wework;
use src\api\src\CorpApi;

class Menu extends Wework
{

	public function create() {
		$menu = [
				[
					"name"=> "扫码",
					"sub_button"=> [
						[
							"type"=> "scancode_waitmsg",
							"name"=> "扫码验布",
							"key"=> "checkcloth",
						],
						[
							"type"=> "scancode_waitmsg",
							"name"=> "扫码缩水",
							"key"=> "shrink",
						]
					]
				],
				[
					"name"=> "发图",
					"sub_button"=> [
						[
							"type"=> "pic_sysphoto",
							"name"=> "系统拍照发图",
							"key"=> "rselfmenu_1_0",
						],
						[
							"type"=> "pic_photo_or_album",
							"name"=> "拍照或者相册发图",
							"key"=> "rselfmenu_1_1",
						],
						[
							"type"=> "pic_weixin",
							"name"=> "微信相册发图",
							"key"=> "rselfmenu_1_2",
						]
					]
				],
				[
					"name"=> "发送位置",
					"type"=> "location_select",
					"key"=> "rselfmenu_2_0"
				]
		];
		$res = (new CorpApi(config('wework.corpid'), intval(config('wework.agentid')), config('wework.secret')))->MenuCreate($menu);
		print_r($res);
		exit;
	}
}